package com.hanthink.web.controller.app.task;

import com.hanthink.common.constant.HttpStatus;
import com.hanthink.common.core.controller.BaseController;
import com.hanthink.common.core.page.TableDataInfo;
import com.hanthink.framework.web.service.TokenService;
import com.hanthink.system.domain.manhour.PLineEquipment;
import com.hanthink.system.domain.pc.EmTask;
import com.hanthink.system.service.pc.IEmTaskService;
import org.apache.poi.ss.usermodel.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.BufferedInputStream;
import java.text.ParseException;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

/**
 * @author: lizhao
 * @codefunction:
 * @creatdate: 2022-05-17 上午9:18
 */
@RestController
@RequestMapping("/equip/equiptaskmanage")
public class EquipTaskManageController extends BaseController {

    @Autowired
    private IEmTaskService iemtaskservice;

    @Autowired
    private TokenService tokenService;

    /**
     * 根据用户部门查询当天有日任务的设备列表
     *
     * @param map 查询参数
     * @return 设备列表清单
     * @throws ParseException
     */
    @PostMapping("/queryeuipment")
    public TableDataInfo queryeuipment(@RequestBody Map<String, Object> map) throws ParseException {

        //BufferedInputStream in = FileUtil.getInputStream("d:/test.txt");


        List<String> list = iemtaskservice.selectEmTaskListbydatetimeanddeptid(map.get("deptid").toString());
        TableDataInfo tableDataInfo = new TableDataInfo();
        tableDataInfo.setCode(HttpStatus.SUCCESS);
        tableDataInfo.setMsg("操作成功");
        tableDataInfo.setRows(list);
        return tableDataInfo;
    }
}
